printback=OFF.

TITLE LIS Cross-section Data center in Luxembourg.

TITLE email: usersupport@lisdatacenter.org .

TITLE LIS Self Teaching Package 2022.

TITLE Part II: Gender, employment, and wages.
TITLE SPSS version.

TITLE last change of this version of the syntax: 15-01-2022.


TITLE Exercise 4: Dependent employment and hourly wages.


define dataprepare ().  
SET ERRORS OFF. 
select if age ge 25 and age le 54.
select if relation ge 1000 and relation le 2200.
weight by ppopwgt.
compute depemp = $sysmis.
if status1 ge 100 and status1 le 120 depemp = 1.
if status1 ge 200 and status1 le 240 depemp = 0.
compute hourwage = hwage1.
if ( hwage1<0)  hourwage=0.
* create top and bottom coded household disposable income.
compute hourwage_log = ln(hourwage). 
EXECUTE.
if (missing(hourwage_log) & NOT(missing(hourwage))) hourwage_log=0. 
EXECUTE.
weight by ppopwgt. 
!enddefine . 

define decilecalc (). 
preserve .  
set tvars names tnumbers values.  
dataset declare decileratio.  
WEIGHT BY ppopwgt. 
sort cases by did.  
split file by did.  
OMS      
 / select tables      
 / if command = ['Frequencies'] subtypes=['Statistics']      
 /destination format = sav        outfile = 'decileratio'      
 /columns sequence = [l1 r2] .  
frequencies variables = hourwage_log 
  /percentiles = 25 50 75 
  /format = notable . 
OMSEND. 
weight off. 
restore. 
match files file = * 
  /table = 'decileratio' 
  /rename (var1 = did) 
  /by did . 
!enddefine .  
 
define topbottom (). 
weight by ppopwgt. 
COMPUTE iqr=hourwage_log_75-hourwage_log_25. 
EXECUTE. 
* detect upper bound for extreme values 
COMPUTE upper_bound=hourwage_log_75 + (iqr * 3). 
EXECUTE. 
COMPUTE lower_bound=hourwage_log_25 - (iqr * 3). 
EXECUTE. 
* top code income at upper bound for extreme values 
if hourwage>exp(upper_bound) hourwage=exp(upper_bound).  
EXECUTE. 
* bottom code income at lower bound for extreme values 
if hourwage<exp(lower_bound) hourwage=exp(lower_bound). 
EXECUTE. 
!enddefine.


match files file = us04p   
  /table = us04h  
  /keep=did hid own dname pwgt ppopwgt relation partner ageyoch age sex immigr educ educ_c emp status1 ptime1 hwage1  
  /by hid.  
  
save outfile = "mydata\us04_yid.sav".  

match files file = be04p   
  /table = be04h  
  /keep=did hid own dname pwgt ppopwgt relation partner ageyoch age sex immigr educ educ_c emp status1 ptime1 hwage1  
  /by hid.  
  
save outfile = "mydata\be04_yid.sav".  


match files file = gr04p   
  /table = gr04h  
  /keep=did hid own dname pwgt ppopwgt relation partner ageyoch age sex immigr educ educ_c emp status1 ptime1 hwage1  
  /by hid.  
  
save outfile = "mydata\gr04_yid.sav". 
 
add file file = "mydata\us04_yid.sav"  
         /file = "mydata\be04_yid.sav"  
         /file = "mydata\gr04_yid.sav". 
		 
save outfile = "mydata\stackex_yid.sav".  
get file = "mydata\stackex_yid.sav".
dataprepare.
decilecalc.
topbottom.
sort cases by dname.
split file by dname.
select if emp = 1.
crosstabs sex by depemp /cells = row.
select all.
sort cases by dname sex.
split file by dname sex.
frequencies variables = hourwage /statistics = median /format = notable. 
